package com.yjd.bi.user.dto;

import com.yjd.bi.user.enums.TicketType;
import com.yjd.comm.util.StringUtil;

import java.io.Serializable;

/**
 * 最近使用的投资券（加息券、普通/满减代金券、预约券、返现券）
 */
public class UserTicketUsedDto implements Serializable {
    /**
     *
     */
    private Long user_id;
    /**
     * 预约券金额
     */
    private Integer subscribe_price;
    /**
     * 加息券比例
     */
    private Double rate;
    /**
     * 代金券类型 0-普通 1-满减
     */
    private Integer volume_type;
    /**
     * 代金券金额（普通/满减均使用该字段）
     */
    private Integer volume_price;
    /**
     * 满减券门槛金额
     */
    private Integer volume_dis_price;
    /**
     * 返现券返现比例
     */
    private Double return_rate;
    
    public String getInfoDescription() {
        StringBuffer buf = new StringBuffer();
        if (subscribe_price != null && subscribe_price != 0) {
            buf.append(String.format(TicketType.SUBSCRIBE.getLabel()+"(%s元)\n", subscribe_price));
        }
        if (rate != null && rate!=0) {
            buf.append(String.format(TicketType.RAISE.getLabel()+"(%s%%)\n", rate));
        }
        if (return_rate != null && return_rate!=0) {
            buf.append(String.format(TicketType.CASH.getLabel()+"(返现比例%s%%)\n", return_rate));
        }
        if (volume_type != null && volume_price != null){
            if (volume_type.intValue() == 1 && volume_dis_price != null && volume_dis_price > 0){
                buf.append(String.format(TicketType.VOLUME_DIS.getLabel()+"(满%s减%s)", volume_dis_price, volume_price));
            }
            if (volume_type.intValue() == 0){
                buf.append(String.format(TicketType.VOLUME_NORMAL.getLabel()+"%s", volume_price));
            }
        }
        if (StringUtil.isEmpty(buf.toString())){
            buf.append("--");
        }
        return buf.toString();
    }

    public Long getUser_id() {
        return user_id;
    }

    public void setUser_id(Long user_id) {
        this.user_id = user_id;
    }

    public Integer getSubscribe_price() {
        return subscribe_price;
    }

    public void setSubscribe_price(Integer subscribe_price) {
        this.subscribe_price = subscribe_price;
    }

    public Double getRate() {
        return rate;
    }

    public void setRate(Double rate) {
        this.rate = rate;
    }

    public Integer getVolume_type() {
        return volume_type;
    }

    public void setVolume_type(Integer volume_type) {
        this.volume_type = volume_type;
    }

    public Integer getVolume_price() {
        return volume_price;
    }

    public void setVolume_price(Integer volume_price) {
        this.volume_price = volume_price;
    }

    public Integer getVolume_dis_price() {
        return volume_dis_price;
    }

    public void setVolume_dis_price(Integer volume_dis_price) {
        this.volume_dis_price = volume_dis_price;
    }

    public Double getReturn_rate() {
        return return_rate;
    }

    public void setReturn_rate(Double return_rate) {
        this.return_rate = return_rate;
    }
}
